﻿using FluentValidation;
using MediatR;

namespace Wips.AppService.Publisher.PublishFlows.Requests
{
    /// <summary>
    /// 执行命令
    /// </summary>
    public class CommandRunScriptRequest : IRequest<List<string>>
    {
        /// <summary>
        /// id
        /// </summary>
        public string Id { get; set; } = "";


        /// <summary>
        /// 当前只有cmd 
        /// </summary>
        public int Type { get; set; } = 0;

        /// <summary>
        /// 命令
        /// </summary>
        public string Command { get; set; } = "";
    }

    /// <summary>
    /// 校验
    /// </summary>
    public class RunScriptRequestValidator : AbstractValidator<CommandRunScriptRequest>
    {
        /// <summary>
        /// 
        /// </summary>
        public RunScriptRequestValidator()
        {
            RuleFor(p => p.Id)
                .Must(p => !string.IsNullOrEmpty(p))
                .WithMessage("流程Id不能为空");
        }
    }

}
